package com.bsoft.gol.editor.dao;


import ctd.persistence.annotation.DAOMethod;
import ctd.persistence.annotation.DAOParam;
import com.bsoft.gol.editor.editor.EditorAuthority;

import java.util.List;

/**
 * Created by Sangs on 2020/4/3.
 */
public abstract class EditorAuthorityDAO extends ctd.persistence.support.hibernate.HibernateSupportDelegateDAO<EditorAuthority> {

    public EditorAuthorityDAO() {
        this.setKeyField("id");
    }

    @DAOMethod(sql = "from EditorAuthority where questionnaireId=:questionnaireId ")
    public abstract List<EditorAuthority> queryEditorAuthorityByQid(@DAOParam("questionnaireId") String questionnaireId);

    @DAOMethod(sql = "from EditorAuthority where type='3' and questionnaireId=:questionnaireId and authorityUser =:authorityUser ")
    public abstract EditorAuthority getEditorAuthorityByUserId(@DAOParam("questionnaireId") String questionnaireId,@DAOParam("authorityUser") String authorityUser);

    @DAOMethod(sql = "from EditorAuthority where questionnaireId=:questionnaireId and type=:type  ")
    public abstract List<EditorAuthority> queryEditorAuthorityByType(@DAOParam("questionnaireId") String questionnaireId,@DAOParam("type") String type);

    @DAOMethod(sql = "delete from EditorAuthority where questionnaireId = :questionnaireId and type=:type ")
    public abstract void removeByQid(@DAOParam("questionnaireId") String questionnaireId,@DAOParam("type") String type);

    @DAOMethod(sql = " update EditorAuthority set status ='0' where questionnaireId=:questionnaireId")
    public abstract void updateStatus(@DAOParam("questionnaireId") String questionnaireId);

}